package com.jiesen.base.modules.login.department.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.jiesen.base.baseDao.BaseServiceImpl;
import com.jiesen.base.modules.login.department.mapper.DepartmentDao;
import com.jiesen.base.modules.login.department.model.Department;
import com.jiesen.base.modules.login.department.service.DepartmentService;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class DepartmentServiceImpl extends BaseServiceImpl<DepartmentDao, Department> implements DepartmentService {

    @Override
    public Department findDepartmentByProvinceAndCityName(String pid, String cid) {
        QueryWrapper<Department> queryWrapper = new QueryWrapper<>();
        queryWrapper.eq("province",pid);
        queryWrapper.eq("city",cid);
        List<Department> departments = baseMapper.selectList(queryWrapper);
        return departments.get(0);
    }

    @Override
    public List<Department> findDepartmentByProvince(Integer pid) {
        return null;
    }

    @Override
    public List<Department> findDepartmentByProvinceName(String pid) {
        return null;
    }

    @Override
    public List<Department> findDepartmentByParentId(Integer pid) {
        return null;
    }

    @Override
    public int insertDepartmentUser(Integer uid, Integer did) {
        return baseMapper.insertDepartmentUser(uid,did);
    }
}
